package cate.game.activity.merge.msg;

import cate.common.table.d.GDFunc;
import cate.game.GameBody;
import cate.game.activity.continuousrecharge.ContinuousRechargeActivity;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBMergeAct;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "连续充值-领取累计及奖励 请求")
public class MergeContinuousRechargeGetAddUpRewardReq implements MsgInput {
    @NoteField("档位")
    public int level;

    @Override
    public MsgConfig conf() {
        return MsgIdBMergeAct.MERGE_ACT_CONTINUOUS_RECHARGE_GET_ADD_UP_REWARD_REQ;
    }

    @Override
    public void execute(GameBody game, ClientContext cc) {
        ContinuousRechargeActivity activity = cc.getRole().getActivity().getEnableActivitySingle(GDFunc.MergeAct.MERGE_ACT_DAILY_RECHARGE);
        if (activity == null) {
            game.notice.message(cc.getRole(), "活动未开启");
        } else {
            EcResult<ContinuousRechargeActivity> r = activity.onGetPrivilegeReward(level);
            if (r.ok()) {
                r.data.noticeUpdate();
            }
            game.notice.message(cc.getRole(), r, true);
        }
    }
}
